package to4.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.TextBox;

public class Wachtwoord {
	public TO4 myService;
	private TO4 thema;
	private String emailad;

	public Wachtwoord(TO4 thema5){
		this.thema = thema5;
	}

	public Panel createPage() {
		FlowPanel wachtwoordPanel = new FlowPanel();
		FlowPanel chapter = new FlowPanel();
		HorizontalPanel horizon1 = new HorizontalPanel();
		HorizontalPanel horizon2 = new HorizontalPanel();
		HorizontalPanel horizon3 = new HorizontalPanel();
		HorizontalPanel horizon4 = new HorizontalPanel();

		Label chapter1 = new Label("Vul hier je e-mailadres in");
		chapter1.addStyleName("chapterpassword");
		Label mailLabel = new Label("E-mailadres:");
		mailLabel.addStyleName("wachtwoordMail");
		final TextBox wachtwoordInputMail = new TextBox();
		wachtwoordInputMail.addStyleName("wachtwoordInputMail");
		wachtwoordInputMail.setVisibleLength(40);
		Button verzenden = new Button("Verzenden");
		verzenden.addStyleName("wachtwoordVerzenden");

		verzenden.addClickHandler(new ClickHandler(){
			@Override
			public void onClick(ClickEvent event) {
				emailad = wachtwoordInputMail.getText();
				thema.sendPassWordmail();
			}
		});
		Anchor terug = new Anchor("Terug");
		terug.addStyleName("wachtwoordTerugLink");
		
		terug.addClickHandler(new ClickHandler(){
			@Override
			public void onClick(ClickEvent event) {
				thema.showInlog();
			}
		});

		horizon1.add(chapter1);
		horizon2.add(mailLabel);
		horizon2.add(wachtwoordInputMail);
		horizon3.add(verzenden);
		horizon4.add(terug);

		chapter.add(horizon1);
		chapter.add(horizon2);
		chapter.add(horizon3);
		chapter.add(horizon4);

		wachtwoordPanel.add(chapter);
		return wachtwoordPanel;
	}

	public String getEmailad(){
		return emailad;
	}
}
